/*
 *   Copyright 1999-2016 Asiainfo Technologies(China),Inc.
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 *
 */

package com.asiainfo.redis.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

/**
 * @version v 1.0 on 2016/4/20 16:16
 * @auther william.xu
 */
@Controller
public class MainControl extends BaseController {

    @RequestMapping("/")
    public String home() {
        return "dashboard";
    }

    @RequestMapping("/host/list")
    public String getHostList(HttpServletRequest request) {
        return "host/list";
    }

    @RequestMapping("/cluster/info")
    public String clusterInfo() {
        return "cluster/info";
    }

    @RequestMapping("/cluster/new")
    public String newCluster() {
        return "cluster/new";
    }

    @RequestMapping("/cluster/add-nodes")
    public String addNodesToCluster() {
        return "cluster/add-nodes";
    }
    @RequestMapping("/cluster/remove-node")
    public String removeNodeFromCluster() {
        return "cluster/remove-node";
    }
    @RequestMapping("/cluster/migrate-slots")
    public String migrateSlots() {
        return "cluster/migrate-slots";
    }


    @RequestMapping("/data/oper-data")
    public String operData() {
        return "data/oper-data";
    }

    @RequestMapping("/data/list-busi-data")
    public String listBusiData() {
        return "data/list-busi-data";
    }

    @RequestMapping("/data/oper-busi-data")
    public ModelAndView operBusiData(@RequestParam(value = "busiDataRuleId", required = true)Long busiDataRuleId) {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("busiDataRuleId", busiDataRuleId);
        modelAndView.setViewName("data/oper-busi-data");
        return modelAndView;
    }


    @RequestMapping("/data/schedule-busi-data")
    public String refreshBusiData() {
        return "data/schedule-busi-data";
    }

}
